<template>
	<el-descriptions ref="ruleFormRef" :column="2" direction="vertical" v-loading="isLoading">

		<!-- <el-descriptions-item width="50%" :label='titles.id'>
			{{ isNullOrEmpty( formInline?.id ) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.projectId'>
			{{ isNullOrEmpty( formInline?.projectId ) }}
		</el-descriptions-item> -->
		<el-descriptions-item width="50%" :label='titles.projectName'>
			{{ isNullOrEmpty(formInline?.projectName) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.unityName'>
			{{ isNullOrEmpty(formInline?.unityName) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.productName'>
			{{ isNullOrEmpty(formInline?.productName) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.place'>
			{{ isNullOrEmpty(formInline?.place) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.deviceSN'>
			{{ isNullOrEmpty(formInline?.deviceSN) }}
		</el-descriptions-item>

		<el-descriptions-item width="50%" :label='titles.alarmTitle'>
			{{ isNullOrEmpty(formInline?.alarmTitle) }}
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.confirm'>
			<!-- {{ isNullOrEmpty(CONFIRMSTATUS[formInline?.confirm].label  ) }} -->
			<!-- {{ isNullOrEmpty(getCconfirm(formInline?.confirm)) }} -->
			<el-tag :type="CONFIRMSTATUSTEXT[formInline.confirm]?.type">
				{{ isNullOrEmpty(CONFIRMSTATUSTEXT[formInline.confirm]?.label) }}</el-tag>
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.alarmType'>
			<!-- {{ isNullOrEmpty( ALARMTYPE[formInline?.].label  ) }} -->
			<!-- {{ isNullOrEmpty( getalarmType(formInline?.alarmType) ) }} -->
			<el-tag :type="ALARMTYPES[formInline.alarmType]?.type">
				{{ isNullOrEmpty(ALARMTYPES[formInline.alarmType]?.label) }}</el-tag>
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.dealStatus'>
			<el-tag :type="HANDLESTATUSTEXT[formInline.dealStatus]?.type">
				{{ isNullOrEmpty(HANDLESTATUSTEXT[formInline.dealStatus]?.label) }}</el-tag>
			<!-- {{ isNullOrEmpty(getdealStatus(formInline?.dealStatus)) }} -->
		</el-descriptions-item>
		<el-descriptions-item width="50%" :label='titles.createdAt'>
			{{ isNullOrEmpty(formInline?.createdAt) }}
		</el-descriptions-item> </el-descriptions>
</template>

<script setup lang="ts">
import { isNullOrEmpty } from '@/utils/functions'
import { ref } from "vue";
import { titles } from './index';
import { ALARMTYPETEXT, ALARMTYPE, ALARMTYPES, CONFIRMSTATUSTEXT, CONFIRMSTATUS, HANDLESTATUS, EVENTLEVEL, HANDLESTATUSTEXT } from "@/constant/alarm-mangenment";
import type { infoType } from '@/api/manage/projectManagementes/alarm-log/index';
const getCconfirm = (item?: any) => {
	if (item) {
		return CONFIRMSTATUSTEXT[item]?.label
	} else {
		return ''
	}
}
const getalarmType = (item?: any) => {
	console.log("item", item);

	if (item) {
		return ALARMTYPES[item]?.label
	} else {
		return ''
	}
}
const getdealStatus = (item?: any) => {
	if (item) {
		return HANDLESTATUSTEXT[item]?.label
	} else {
		return ''
	}
}

type FormProps = {
	formInline: infoType,
	isLoading: boolean
}

const props = withDefaults(defineProps<FormProps>(), {
	formInline: () => ({} as infoType),
	isLoading: false
});

const ruleFormRef = ref();
//  const newFormInline = ref(props.formInline as any);
//
//
//  watch(()=>props.formInline,()=>{
//  	newFormInline.value = props.formInline
//  },{
//  	deep:true,
//  	immediate:true
//  })

function getRef() {
	return ruleFormRef.value;
}

defineExpose({ getRef });
</script>
